package com.qingcloud.fexecutor.base.enums;

/**
 * 标准软件分类枚举.
 */
public enum DeploySoftwareCategoryEnum {

    QINGCLOUD(1, "业务应用", "&#xe7f7;"),
    DATABASE(2, "数据库", "&#xe7e9;"),
    MIDDLEWARE(3, "中间件", "&#xe788;"),
    OTHER(4, "其他", "&#xe7f3;");

    public final Integer code;
    public final String name;
    public final String icon;

    DeploySoftwareCategoryEnum(int code, String name, String icon) {
        this.code = code;
        this.name = name;
        this.icon = icon;
    }

    public static String getNameByCode(Integer code) {
        for (DeploySoftwareCategoryEnum type : DeploySoftwareCategoryEnum.values()) {
            if (code.equals(type.code)) {
                return type.name;
            }
        }
        return "";
    }

    public static DeploySoftwareCategoryEnum findByName(String name) {
        for (DeploySoftwareCategoryEnum type : DeploySoftwareCategoryEnum.values()) {
            if (type.name().equalsIgnoreCase(name)) {
                return type;
            }
        }
        return null;
    }

}
